/*
 * Recent Post with Spy effect for blogger.com
 * Script combined from bloggerstricks.com and spy effect from jqueryfordesigners.com
 * By Abu Farhan (www.abu-farhan.com)
 * Modified by Taufik Nurrohman to support jQuery 1.4+ (http://hompimpaalaihumgambreng.blogspot.com)
 */
jQuery(function() {
	jQuery("ul.spy").simpleSpy(limitspy, intervalspy, animspeed).bind("mouseenter", function () {
		jQuery(this).trigger("stop");
	}).bind("mouseleave", function () {
		jQuery(this).trigger("start");
	});
});
(function (e) {
	e.fn.simpleSpy = function (f, g) {
		f = f || 4;
		g = g || 5000;
		return this.each(function () {
			var l = e(this),
				k = true,
				i = [],
				m = f,
				o = 0,
				h = l.find("> li:first").height();
			l.find("> li").each(function () {
				i.push("<li>" + e(this).html() + "</li>");
			});
			o = i.length;
			l.find("> li").filter(":gt(" + (f - 1) + ")").remove();
			l.bind("stop", function () {
				k = false;
			}).bind("start", function () {
				k = true;
			});

			function n() {
				if (k) {
					var p = e(i[m]).hide().prependTo(l);
					l.find("> li:last").animate({
						opacity: 0
					}, animspeed, function() {
						p.css('opacity', 0).slideDown(animspeed, function() {
							p.animate({opacity:1}, animspeed);
						});
						e(this).remove();
					});
					m++;
					if (m >= o) {
						m = 0;
					}
				}
				setTimeout(n, g);
			}
			n();
		});
	};
})(jQuery);

function showrecentposts(z) {
	document.write('<div id="spylist"><ul class="spy">');
	var j = 0, img = [];
	for (var o = 0; o < numposts; o++) {
		var w = z.feed.entry[o];
		var g = w.title.$t;
		var f;
		var p;
		if (o == z.feed.entry.length) {
			break;
		}
		for (var l = 0; l < w.link.length; l++) {
			if (w.link[l].rel == "alternate") {
				p = w.link[l].href;
				break;
			}
		}
		for (var l = 0; l < w.link.length; l++) {
			if (w.link[l].rel == "replies" && w.link[l].type == "text/html") {
				f = w.link[l].title.split(" ")[0];
				break;
			}
		}
		if ("content" in w) {
			var r = w.content.$t;
		} else {
			if ("summary" in w) {
				var r = w.summary.$t;
			} else {
				var r = "";
			}
		}
		postdate = w.published.$t;

		if("media$thumbnail" in w) {
			postimg = w.media$thumbnail.url;
		} else {
			postimg = imgBlank;
		}		

		cmtext = (text != "no") ? '(' + f + " " + text + ")" : "";
		var q = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
		var x = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"];
		var u = postdate.split("-")[2].substring(0, 2);
		var h = postdate.split("-")[1];
		var t = postdate.split("-")[0];
		for (var e = 0; e < q.length; e++) {
			if (parseInt(h) == q[e]) {
				h = x[e];
				break;
			}
		}
		var n = (showPostDate) ? "(" + u + " " + h + " " + t + ")" : "";
		var v = '<li><a href="' + p + '"><img src="' + postimg + '" width="' + thumbwidth + '" height="' + thumbheight + '" class="recent-thumb"/></a><a href="' + p + '" class="recent-link">' + g + '</a><div class="spydate">' + n + '</div><div class="spycomm">' + cmtext + '</div>';
		document.write(v);
		j++
	}
	document.write("</ul></div>");
}

